package com.ruoyi.youtian.controller;

import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.youtian.service.FaultStatisticsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

import static com.ruoyi.common.utils.PageUtils.startPage;

@RestController
@RequestMapping("/youtian/fault")
public class FaultStatisticsControoler {

    @Autowired
    private FaultStatisticsService faultStatisticsService;


    /**
     * 故障模型分析子部门查询
     * @return
     */
    @GetMapping("/list")
    public TableDataInfo subsidiary(Integer id){
        startPage();
        return faultStatisticsService.list(id);
    }

    /**
     * 饼图数据统计查询
     * @param id
     * @return
     */
    @GetMapping("/Chart")
    public Map<String,Object> PieChart(Integer id){
        return faultStatisticsService.PieChartByid(id);
    }

    /**
     * 柱状图数据统计查询
     * @param id
     * @return
     */
    @GetMapping("/Histogram")
    public AjaxResult Histogram(Integer id){
        return faultStatisticsService.Histogram(id);
    }



}
